package Twx0429;

public class User {
    private String name;
    private String pwd;
    private boolean isLogin;

    public User(String name, String pwd, boolean isLogin) {
        this.name = name;
        this.pwd = pwd;
        this.isLogin = isLogin;
    }

    public int login(String pwdIn) {
        if (pwd.equals(pwdIn)) {
            if (isLogin) {
                return 0;
            }
            isLogin = true;
            return 1;
        }
        return 2;
    }

    public String getName(){
        return name;
    }

    public void setName(String name){
        this.name = name;
    }

    public String getPwd(){
        return pwd;
    }

    public void setPwd(String pwd){
        this.pwd = pwd;
    }

    public boolean isIsLogin(){
        return isLogin;
    }

    public void setIsLogin(boolean isLogin){
        this.isLogin = isLogin;
    }
}
